Socket
Socket
Sign inDemoInstall

color2k

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color2k

a color parsing and manipulation lib served in roughly 2kB


Version published
Weekly downloads
953K
decreased by-0.52%
Maintainers
1
Weekly downloads
 
Created

What is color2k?

color2k is a lightweight and fast JavaScript library for color manipulation and conversion. It provides a variety of functions to work with colors, including conversion between different color formats, color mixing, and color adjustments.

What are color2k's main functionalities?

Color Conversion

Convert colors between different formats such as HEX to RGB.

const color2k = require('color2k');
const hexColor = '#ff5733';
const rgbColor = color2k.hexToRgb(hexColor);
console.log(rgbColor); // Output: { r: 255, g: 87, b: 51 }

Color Mixing

Mix two colors together with a specified ratio.

const color2k = require('color2k');
const color1 = '#ff5733';
const color2 = '#33ff57';
const mixedColor = color2k.mix(color1, color2, 0.5);
console.log(mixedColor); // Output: '#996645'

Color Lightening

Lighten a color by a specified amount.

const color2k = require('color2k');
const color = '#ff5733';
const lightenedColor = color2k.lighten(color, 0.2);
console.log(lightenedColor); // Output: '#ff8a66'

Color Darkening

Darken a color by a specified amount.

const color2k = require('color2k');
const color = '#ff5733';
const darkenedColor = color2k.darken(color, 0.2);
console.log(darkenedColor); // Output: '#cc4629'

Color Alpha Adjustment

Adjust the alpha (transparency) of a color.

const color2k = require('color2k');
const color = 'rgba(255, 87, 51, 1)';
const adjustedAlphaColor = color2k.alpha(color, 0.5);
console.log(adjustedAlphaColor); // Output: 'rgba(255, 87, 51, 0.5)'

Other packages similar to color2k

Keywords

FAQs

Package last updated on 08 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc